package com.jmb.api.common.utils;

import com.jmb.api.common.login.LoginUserHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;

@Component
public class LoginUserInfo {

    @Autowired
     RedisUtil redisUtil;
    // 我要从redis里边获取我的缓存用户名称
    public String Username(){
        Long userId = LoginUserHolder.getLoginUser().getUserId();
        Object hashmap = redisUtil.get(LoginConstants.loginInfo + userId);
        return ((HashMap<String, String>) hashmap).get("username");

    }
}
